package com.ruoyi.wq.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.Condition;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.wq.mapper.WqNoticeChatMapper;
import com.ruoyi.wq.domain.WqNoticeChat;
import com.ruoyi.wq.domain.vo.WqNoticeChatVO;
import com.ruoyi.wq.service.IWqNoticeChatService;

/**
 * 聊天通知Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-11-08
 */
@Service
public class WqNoticeChatServiceImpl extends ServiceImpl<WqNoticeChatMapper, WqNoticeChat> implements IWqNoticeChatService {

    @Autowired
    private WqNoticeChatMapper wqNoticeChatMapper;

    /**
     * 查询聊天通知
     * 
     * @param id 聊天通知主键
     * @return 聊天通知
     */
    @Override
    public WqNoticeChat selectWqNoticeChatById(String id)
    {
        return wqNoticeChatMapper.selectWqNoticeChatById(id);
    }

    /**
     * 查询聊天通知列表
     * 
     * @param wqNoticeChat 聊天通知
     * @return 聊天通知
     */
    @Override
    public List<WqNoticeChat> selectWqNoticeChatList(WqNoticeChat wqNoticeChat)
    {
        return wqNoticeChatMapper.selectWqNoticeChatList(wqNoticeChat);
    }

    /**
     * 新增聊天通知
     * 
     * @param wqNoticeChat 聊天通知
     * @return 结果
     */
    @Override
    public int insertWqNoticeChat(WqNoticeChat wqNoticeChat)
    {
        wqNoticeChat.setCreateTime(DateUtils.getNowDate());
        return wqNoticeChatMapper.insertWqNoticeChat(wqNoticeChat);
    }

    /**
     * 修改聊天通知
     * 
     * @param wqNoticeChat 聊天通知
     * @return 结果
     */
    @Override
    public int updateWqNoticeChat(WqNoticeChat wqNoticeChat)
    {
        wqNoticeChat.setUpdateTime(DateUtils.getNowDate());
        return wqNoticeChatMapper.updateWqNoticeChat(wqNoticeChat);
    }

    /**
     * 批量删除聊天通知
     * 
     * @param ids 需要删除的聊天通知主键
     * @return 结果
     */
    @Override
    public int deleteWqNoticeChatByIds(String[] ids)
    {
        return wqNoticeChatMapper.deleteWqNoticeChatByIds(ids);
    }

    /**
     * 删除聊天通知信息
     * 
     * @param id 聊天通知主键
     * @return 结果
     */
    @Override
    public int deleteWqNoticeChatById(String id)
    {
        return wqNoticeChatMapper.deleteWqNoticeChatById(id);
    }

	@Override
	public TableDataInfo getNoticePageList(WqNoticeChat wqNoticeChat) {
		wqNoticeChat.setToUserId(SecurityUtils.getUserId());
		IPage<WqNoticeChatVO> pageList = wqNoticeChatMapper.getNoticePageList(Condition.getPage(wqNoticeChat), wqNoticeChat);
		return Condition.getTableDataInfo(pageList.getRecords(), pageList.getTotal());
	}

}
